import React, { Component } from 'react';
import { Tabs } from 'antd';
import PropTypes from 'prop-types';
import TabTitle from '@/components/TabTitle/TabTitle';
import Today from './components/Today/Today'
import History from './components/History/History'

const TabPane = Tabs.TabPane;

class Statistics extends Component {
  tabsOnChange = (key) => {
    const { history } = this.props;
    history.push(`/integration/statistics/${key}`)
  }

  static propTypes = {
    history: PropTypes.object.isRequired
  }

  render() {
    const breadCrumb = ['Integration', 'Statistics']

    return (
      <div className="news-list">
        <TabTitle
          showTabbar={true}
          title="Statistics"
          breadCrumb={breadCrumb} />
        <Tabs
          tabBarStyle={{paddingLeft: '28px'}}
          activeKey={this.props.match.params.type}
          onChange={this.tabsOnChange}>
          <TabPane tab="today" key="0">
            <Today />
          </TabPane>
          <TabPane tab="history" key="1">
            <History />
          </TabPane>
        </Tabs>
      </div>
    )
  }
}

export default Statistics;
